﻿<Page x:Class="SolickManagerV3_4.Pages.ListCharacteristicsPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:SolickManagerV3_4.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="680" d:DesignWidth="1280"
      Title="ListCharacteristicsPage">

    <Grid>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="310"/>
        </Grid.ColumnDefinitions>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>

            <Grid>
                
                <Border Background="White"
                        CornerRadius="10"
                        MinWidth="940"
                        MinHeight="580"
                        BorderThickness="0"
                        Margin="20 25 10 00"
                        Padding="0 20 0 0">

                    <DataGrid Style="{DynamicResource DataGridSolickStyle}" AutoGenerateColumns="False" 
                              VerticalAlignment="Top"
                              HeadersVisibility="Column"
                              IsReadOnly="true"
                              ItemsSource="{Binding Characteristics}"
                              SelectedItem="{Binding SelectedCharacteristic}"
                              HorizontalAlignment="Left"
                              MinWidth="940"
                              Width="auto"
                              HorizontalGridLinesBrush="Transparent"
                              VerticalGridLinesBrush="Transparent">
                        <DataGrid.ColumnHeaderStyle>
                            <Style TargetType="{x:Type DataGridColumnHeader}">
                                <Setter Property="Background" Value="#3993DD"/>
                                <Setter Property="Foreground" Value="White"/>
                                <Setter Property="HorizontalAlignment" Value="Stretch"/>
                                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                <Setter Property="VerticalContentAlignment" Value="Center"/>
                                <Setter Property="Padding" Value="5 1"/>
                            </Style>
                        </DataGrid.ColumnHeaderStyle>
                        <DataGrid.CellStyle>
                            <Style TargetType="{x:Type DataGridCell}">
                                <Setter Property="VerticalContentAlignment" Value="Center"/>
                                <Setter Property="VerticalAlignment" Value="Center"/>
                                <Setter Property="FontFamily" Value="Inter"/>
                                <Setter Property="FontSize" Value="11"/>

                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True" >
                                        <Setter Property="Background" Value="#24FFE9" />
                                        <Setter Property="Foreground" Value="Black" />

                                        <Setter Property="BorderThickness" Value="0"/>
                                    </Trigger>

                                    <Trigger Property="IsMouseOver" Value="True">
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </DataGrid.CellStyle>
                        <DataGrid.RowStyle>
                            <Style TargetType="{x:Type DataGridRow}">
                                <Setter Property="BorderThickness" Value="0"/>
                                <Setter Property="Background" Value="White"/>
                                <Setter Property="VerticalContentAlignment" Value="Center"/>
                                <Setter Property="FontFamily" Value="Inter"/>
                                <Setter Property="FontSize" Value="11"/>

                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Background" Value="#24FFE9"/>
                                        <Setter Property="Foreground" Value="Black"/>
                                    </Trigger>

                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="#B5FFF8" />
                                        <Setter Property="Foreground" Value="Black" />

                                        <Setter Property="BorderThickness" Value="0"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </DataGrid.RowStyle>
                        <DataGrid.Columns>
                            <DataGridTextColumn Width="60*" ElementStyle="{DynamicResource StyleDataGridTextColumn}" Header="Код" Binding="{Binding Id}"/>
                            <DataGridTextColumn Width="880*" ElementStyle="{DynamicResource StyleDataGridTextColumn}" Header="Название" Binding="{Binding Title}"/>
                            
                        </DataGrid.Columns>
                    </DataGrid>
                </Border>
                
                <Grid Height="34" VerticalAlignment="Top" Margin="20 5 10 0">
                    <Label Content="Характеристики" 
                           FontFamily="Assets/Inter/#Inter-V.ttf"
                           FontSize="22"
                           Margin="10 0 0 0"
                           HorizontalAlignment="Left"/>
                    <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                        <Button Style="{DynamicResource ButtonRoundStyle}" Margin="0 0 10 0"
                                Click="AddNewCharacteristic">
                            <Border CornerRadius="5"
                                    BorderThickness="0"
                                    Background="#F0F0F0"
                                    Height="32"
                                    Width="32"
                                    Padding="2">
                                <Image Source="/Pages/Images/Add.png"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center"/>
                            </Border>
                        </Button>
                        <Button Style="{DynamicResource ButtonRoundStyle}" Margin="0 0 10 0" Click="EditSelectedCharacteristic">
                            <Border CornerRadius="5"
                                    BorderThickness="0"
                                    Background="#F0F0F0"
                                    Height="32"
                                    Width="32"
                                    Padding="2">
                                <Image Source="/Pages/Images/Edit.png"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center"/>
                            </Border>
                        </Button>
                        <Button Style="{DynamicResource ButtonRoundStyle}" Click="DeleteSelectedCharacteristic">
                            <Border CornerRadius="5"
                                    BorderThickness="0"
                                    Background="#F0F0F0"
                                    Height="32"
                                    Width="32"
                                    Padding="2">
                                <Image Source="/Pages/Images/Delete.png"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center"/>
                            </Border>
                        </Button>
                    </StackPanel>
                </Grid>
            </Grid>




        </Grid>

        <Border Grid.Column="1" 
                    CornerRadius="10" 
                    Width="280"
                    Height="auto"
                    MinHeight="220"
                    Margin="10 20 20 20"
                    Padding="20"
                    Background="#3993DD"
                    VerticalAlignment="Top">
            <StackPanel>
                <Border Width="240"
                        Height="50"
                        CornerRadius="10"
                        BorderThickness="1"
                        BorderBrush="White"
                        Padding="10"
                        Margin="0 0 0 20">
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Поиск"
                                   Margin="0 0 2 0"
                                   FontSize="14"
                                   FontFamily="Inter/#Inter-V.ttf"
                                   Foreground="White"/>
                        <TextBox Height="20"
                                     HorizontalAlignment="Right"
                                     Width="145"
                                     VerticalContentAlignment="Center"
                                     FontSize="14"
                                     FontFamily="Inter/#Inter-V.ttf"
                                     Foreground="Black"
                                     BorderThickness="0"
                                     Background="White"
                                     Style="{DynamicResource RoundTextBox}"
                                     Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"/>
                    </StackPanel>
                </Border>
                <Border Width="240"
                        CornerRadius="10"
                        BorderThickness="1"
                        BorderBrush="White"
                        Padding="10"
                        Height="auto">
                    <StackPanel >
                        <Label Content="Характеристика"
                               FontSize="16"
                               FontFamily="Inter/#Inter-V.ttf"
                               Foreground="White"
                               HorizontalContentAlignment="Center"/>
                        <StackPanel Orientation="Horizontal" 
                                    Width="218">
                            <Label Content="Название"
                                   FontSize="14"
                                   FontFamily="Inter/#Inter-V.ttf"
                                   Foreground="White"
                                   Margin="0 0 3 0"/>
                            <TextBox Text="{Binding SelectedCharacteristic.Title}"
                                     Style="{DynamicResource RoundTextBox}"
                                     Height="20"
                                     Width="142"/>
                        </StackPanel>

                        <Button Style="{DynamicResource ButtonRoundStyle}" 
                                Content="Применить"
                                Width="180"
                                Height="30"
                                FontFamily="Inter/#Inter-V.ttf"
                                FontSize="18"
                                Foreground="Black"
                                Background="White"
                                BorderThickness="0"
                                Margin="0 14 0 0"
                                Click="SaveEditSelectedCharacteristic"/>
                    </StackPanel>
                </Border>
            </StackPanel>
        </Border>
    </Grid>
</Page>
